﻿@{
    ViewBag.Title = "SelcetDeskWork";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@using Common.BaseLibrary.Authorization
@using DepartmentWork.Model





<link href="~/Assets/plugins/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
<script src="~/Assets/plugins/bootstrap-select/bootstrap-select.min.js"></script>
<link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker3.css" rel="stylesheet" />
<link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker-theme.css" rel="stylesheet" />
<script src="~/Assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script src="~/Assets/plugins/chosen/chosen.jquery.min.js"></script>
<script src="~/Assets/js/pages/form-elements.js"></script>
<script src="~/Assets/js/jquery.validate.min.js"></script>




<div class="page-header">
    <div class="pull-left">
        <ol class="breadcrumb visible-sm visible-md visible-lg">
            <li><a href="@Url.Action("Index", "Home", new { area = "" })"><i class="icon fa fa-home"></i>主页</a></li>
            <li class="active"><a href="#"><i class="fa fa-envelope"></i>查询</a></li>
        </ol>
    </div>
</div>


<div style="height:10px">
    <h3 style="text-align:center;color:black">科室工作查询</h3>
</div>


<script>
    window.onload = function () {

        $("#selcet_BTime").datepicker({
            autoclose: true,
            pickerPosition: "bottom-right"
        });
        $("#selcet_DTime").datepicker({
            autoclose: true,
            pickerPosition: "bottom-right"
        });
    };
</script>

<script>
    function selcet() {
       
        if ($("#selcet_text_DTime_id").val() < $("#selcet_text_BTime_id").val())
        {
            alert("开始时间不能大于结束时间");
            return false;
        }

        $.ajax({
            type: "POST",
            //url: "/KSManager/QueryArea/DeskWorkSelcet/SelcetS",
            url:'@Url.Action("SelcetS","DeskWorkSelcet",new{area="QueryArea"})',
            data: "NameN=" + $("#selcet_workname_id").val() + "&&NameId=" + $("#select_ID").val()
                + "&&NameTime=" + $("#selcet_timeover").val() + "&&BTime="
                + $("#selcet_text_BTime_id").val() + " "
                + $("#tb_StartTimeHour").val() + "&&DTime="
                + $("#selcet_text_DTime_id").val() + " " + $("#tb_EndTimeHour").val(),
            error: function () { alert("服务器出错！"); },
            success: function (data) {

                createShowingTable(data);

            }
        });
    }
    
    function createShowingTable(data) {
        var tableStr =   "<table class='table table-hover'>";
        tableStr = tableStr
        + "<thead>"
        + "<tr>"
        + "<th style='text-align: center;color:black'>工作名称</th>"
        + "<th style='text-align: center;color:black'>工作编号</th>"
        + "<th style='text-align: center;color:black'>创建日期</th>"
        + "<th style='text-align: center;color:black'>发布人</th>"
        + "<th style='text-align: center;color:black'>负责人</th>"
        + "<th style='text-align: center;color:black'>完成期限</th>"
        + "<th style='text-align: center;color:black'>结束时间</th>"
        + "<th style='text-align: center;color:black'>完成状态</th>"
        + "</tr>"
        + "</thead>";
        var len = data.length;
        for (var i = 0; i < len; i++) {
            tableStr = tableStr
            + "<tr>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_NAME"] + "</td>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_NO"] + "</td>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_CREATETIME_SELCET"] + "</td>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_FOUNDER"] + "</td>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_PRINCIPAL"] + "</td>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_DEADINE_SELCET"] + "</td>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_OVERTIME_SELCET"] + "</td>"
            + "<td style='text-align: center;color:black'>" + data[i]["DESKWORK_STATUS"] + "</td>"
            + "</tr>";
        }
        $("#xxx").html(tableStr);
    }

</script>

<form class="form-horizontal" role="form" action="@Url.Action("Query", "Query", new { area = "QueryArea" })" method="POST">
    <div class="form-group">
        <div style="height: 10px"></div>
        <div  style="text-align:center">
            <hr style="width:100%; height:1px;border:none;border-top:2px solid;"/>
            <label style="color:black">工作名称：</label>
            <input style="width: 15%;color:black " placeholder="输入工作名称关键字" type="text" name="selcetAll" id="selcet_workname_id">
            <label style="width:3%"></label>
            <label style="color:black">负责人：</label>
            <select style="width:10%;color:black" name="selectname_ID" id="select_ID">
                                     <option value="0">全部</option>
                               @{
                                   List<UserInfoViewModel> userListt = (List<UserInfoViewModel>)TempData["UserList"];
                                    if (userListt != null)
                                    {
                                        for (int i = 0; i < userListt.Count(); i++)
                                        {
                                            var item = userListt[i];
                                    <option value="@item.UserId">@item.UserName</option>
                                        }
                                    }
                                }
                          </select>
            <label style="width:3%"></label>
            <label style="color:black">是否超期：</label>
            <select id="selcet_timeover" style="width:7%">
                <option value="0">全部</option>
                <option value="1">超期</option>
                <option value="2">未超期</option>
            </select>

             <label style="width:3%"></label>
             <label style="color:black">起止时间：</label>
            <div class="input-append date" style="display:inline-block"   id="selcet_BTime" data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                <input  style="color:black" id="selcet_text_BTime_id"  name="selcet_text_BTime" size="10" type="text" value="@DateTime.Now.ToString("yyyy-MM-dd")"> 
                <span class="add-on"><i  class="icon-th"></i></span>
            </div>
                        <select id="tb_StartTimeHour" name="tb_StartTimeHour">
                @{
                    for (int i = 0; i < 24; i++)
                    {
                         <option value="@i:00">@i :00</option>
                    }
                }
            </select>
             <label style="display:inline-block" >-</label>
            <div  class="input-append date"  style="display:inline-block"  id="selcet_DTime"  data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                <input  style="color:black"  id="selcet_text_DTime_id"  name="selcet_text_DTime" size="10" type="text"  value="@DateTime.Now.ToString("yyyy-MM-dd")">
                <span class="add-on"><i class="icon-th"></i></span>
            </div>
                        <select id="tb_EndTimeHour" name="tb_EndTimeHour">
                @{
                    for (int i = 0; i < 24; i++)
                    {
                         <option value="@i:00">@i :00</option>
                    }
                }
            </select>
            <label style="width:3%"></label>
            <input  onclick="selcet()"  value="查询" class="btn btn-primary" />
            <hr style="width:100%; height:1px;border:none;border-top:2px solid;"/>
       
         </div>
     </div>
</form>


<div class="row">
    <div class="col-lg-12">@*宽度*@
        <div class="panel">@*背景颜色*@
            <div class="panel-body">
                <div class="tabs">
                    <div class="tab-content">
                        <div id="overview" class="tab-pane active">
                            <div class="panel-body">
                                <div id="xxx" class="table-responsive">
                                 
                                </div>
                                <div class="bk-margin-5 btn-group" style="float: right">
                                @*  @Html.ShowPageNavigate((int)ViewData["pageIndexExecute"], (int)ViewData["pageSizeExecute"], (int)ViewData["totalExecute"])*@
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


